/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package presenter;

import boundary.GerenteView;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 *
 * @author jakson
 */
public class GerentePresenter {

    private GerenteView view;
    public GerentePresenter() {
        
        view = new GerenteView(null, true);
        
        view.getItmAbrirConta().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                
                chamaCriarConta();
 
            }
        });
        
        view.getItmCadastrarCliente().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
               chamarAddClientesPresenter();
            }
        });
        
        view.getItmSair().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                sair();
            }
        });
        
        view.getItmConsultarConta().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
               chamarListarContas();
            }
        });
        
        view.getItmManter().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
               ListarCliente();
            }
        });
        
        view.getItmDesbloquear().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                desbloquearAcesso();
            }
        });
        view.setLocationRelativeTo(view);
        view.setVisible(true);
    }
    
    
    private void chamarAddClientesPresenter(){
        //view.dispose();
        new AddClientesPresenter("nova",null);
    }
    
    private void sair(){
        view.dispose();
    }
    
    private void chamaCriarConta(){
        //view.dispose();
        new ListarClientePresenter("criaConta");
        
    }
    
    private void  ListarCliente(){
        
        new ListarClientePresenter("Listar");
    }
    
    private void chamarListarContas(){
       // view.dispose();
        new ListarContasCorrentesPresenter();
    }
    
    private void desbloquearAcesso(){
        new ListarClientePresenter("desbloquear");
    }
}
